/**
 * 系统管理的菜单
 */
Vue.component('sys-menu', {
    props: {
        index: {
            type: String,
            default: "server.html"
        }
    },
    data: function () {
        return {
            isLogin: sessionStorage.getItem("token"),
            user: sessionStorage.getItem("user"),
        }
    },
    methods: {
        selected: function (index, indexPath) {
            window.open("/sys/" + index, '_self');
        },
    },
    template: `
        <el-menu :default-active="index" @select="selected" style="height: 100%;">
            <el-menu-item index="server.html">
                <template slot="title">
                   <i class="el-icon-set-up"></i>
                   <span>端口设置</span>
                </template>
            </el-menu-item>
            <el-menu-item index="detail.html">
                <template slot="title">
                   <i class="el-icon-film"></i>
                   <span>流媒体配置详细</span>
                </template>
            </el-menu-item>
            <el-menu-item index="sdkuser.html" v-if="isLogin">
                <template slot="title">
                    <i class="el-icon-user"></i>
                    <span>SDK用户授权</span>
                </template>
            </el-menu-item>
            <el-menu-item index="tags.html" v-if="isLogin">
                <template slot="title">
                    <i class="el-icon-collection-tag"></i>
                    <span>标签管理</span>
                </template>
            </el-menu-item>
        </el-menu>
    `
});